home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Snippets / PNL Libraries / Libraries / UGLibrary / UGLibrary.p < prev    next >
Text File  |  1997-01-31  |  6KB  |  225 lines

  1. {                                                            }
  2. {    Created: Sunday, December 9, 1991 at 9:55 PM            }
  3. {    Modified: Saturday, January 18, 1992 at 9:44 PM            }
  4. {    UGLibrary.p                                                }
  5. {    Pascal Interface to UGLibrary.o                            }
  6. {    The library to manipulate the Users & Groups Data File    }
  7. {                                                            }
  8. {        Copyright Apple Computer, Inc. 1991                    }
  9. {        All rights reserved                                    }
  10. {                                                            }
  11.  
  12. unit UGLibrary;
  13.  
  14. interface
  15.  
  16.     uses
  17.         OSUtils;
  18.  
  19. {$PUSH}
  20. {$ALIGN MAC68K}
  21.  
  22.     const
  23.     { error codes for the UGLibrary }
  24.         ugUserAlreadyExists = 1;
  25.         ugGroupAlreadyExists = 2;
  26.         ugULInfoRecNotCreated = 3;
  27.         ugNoMoreUGs = 4;
  28.         ugUserNotFound = 5;
  29.         ugGroupNotFound = 6;
  30.         ugNotAUser = 7;
  31.         ugNotAGroup = 8;
  32.         ugTooManyGroups = 9;
  33.         ugNotaMember = 10;
  34.         ugNoMoreUsers = 11;
  35.         ugNoMoreGroups = 12;
  36.         ugBadParamErr = 13;
  37.         ugUserAlreadyAMember = 14;
  38.         ugAPrmryGroupExists = 15;
  39.         ugServerRunning = 16;
  40.         ugAdminRunning = 17;
  41.         ugNotBtree = 18;
  42.         ugBadKey = 19;
  43.         ugDskFull = 20;
  44.         ugBadUID = 21;
  45.         ugInvalidPasswd = 22;
  46.         ugEOF = 23;
  47.         ugBOF = 24;
  48.         ugDefNameErr = 98;
  49.         ugFatalError = 99;
  50.  
  51.     { ugUserFlags for UGNewUser, UGGetUserInfo, and UGSetUserInfo }
  52.         IACEnabled = $0001;
  53.         LoginEnabled = $0100;
  54.         SuperUser = $0200;
  55.         NoChangePwd = $0400;
  56.         GetNewPwd = $1000;
  57.  
  58.     { ugSrvrFlags[0] for UGGetULInfo and UGSetULInfo }
  59.         Apple2 = 1;
  60.         NoGuests = 2;
  61.         IACGuestEnabled = 16;
  62.         IACGlobalEnabled = 32;
  63.  
  64.     { ugSrvrFlags[1] for UGGetULInfo and UGSetULInfo }
  65.         DontSavePwd = 1;
  66.  
  67.     { ugChngFlags codes for UGSetUserInfo }
  68.         ChngUserFlags = 1;
  69.         ChngUserPasswd = 2;
  70.         ChngUAll = 3;
  71.  
  72.     { ugChngFlags codes for UGSetULInfo }
  73.         ChngSrvrFlags = 1;
  74.         ChngAdmnKey = 2;
  75.         ChngMinPwdLen = 4;
  76.         ChngMaxBadLogins = 8;
  77.         ChngPwdExpDate = 16;
  78.         ChngULAll = 31;
  79.  
  80.     { server version as returned by UGGetULInfo }
  81.         Sys7SrvrVer = 3;
  82.         AS3SrvrVer = 4;
  83.  
  84.     type
  85.         Str199 = string[199];
  86.         Str8 = string[8];
  87.  
  88.     { These are the Param Blocks for the interface calls: }
  89.  
  90.     { Use UGFilePB for UGOpenFile, UGCloseFile and UGCreateFile }
  91.         UGFilePB = record
  92.                 qLink: QElemPtr;
  93.                 qType: INTEGER;
  94.                 ugTrap: INTEGER;
  95.                 ugCmdAddr: Ptr;
  96.                 ugCompletion: ProcPtr;
  97.                 ugResult: OSErr;
  98.                 ugNamePtr: StringPtr;
  99.                 ugVRefNum: INTEGER;
  100.                 ugRefNum: INTEGER;
  101.                 ugDirID: LONGINT;
  102.                 ugAccessID: LONGINT;
  103.                 ugUserID: LONGINT;
  104.                 ugGroupID: LONGINT;
  105.                 ugAdminKey: StringPtr;
  106.             end;
  107.  
  108.     { Use UGUserPB for UGNewUser, UGDeleteUser, UGRenameUser, UGGetUserInfo, }
  109.     { UGSetUserInfo, and UGAuthenticateUser }
  110.         UGUserPB = record
  111.                 qLink: QElemPtr;
  112.                 qType: INTEGER;
  113.                 ugTrap: INTEGER;
  114.                 ugCmdAddr: Ptr;
  115.                 ugCompletion: ProcPtr;
  116.                 ugResult: OSErr;
  117.                 ugNamePtr: StringPtr;
  118.                 ugVRefNum: INTEGER;
  119.                 ugRefNum: INTEGER;
  120.                 ugDirID: LONGINT;
  121.                 ugAccessID: LONGINT;
  122.                 ugUserID: LONGINT;
  123.                 ugGroupID: LONGINT;
  124.                 ugPosOffset: INTEGER;
  125.                 ugMisc: StringPtr;
  126.                 ugChngFlags: INTEGER;
  127.                 ugPassword: StringPtr;
  128.                 ugUserFlags: LONGINT;
  129.                 ugNumBadLogins: INTEGER;
  130.                 ugPwdDate: LONGINT;
  131.                 ugNumGroups: INTEGER;
  132.                 ugGroups: array[0..41] of LONGINT;
  133.             end;
  134.  
  135.     { Use UGGroupPB for UGNewGroup, UGDeleteGroup, UGRenameGroup, UGGetGroupInfo, }
  136.     { UGAssignUserToGroup, and UGDeleteUserFromGroup }
  137.         UGGroupPB = record
  138.                 qLink: QElemPtr;
  139.                 qType: INTEGER;
  140.                 ugTrap: INTEGER;
  141.                 ugCmdAddr: Ptr;
  142.                 ugCompletion: ProcPtr;
  143.                 ugResult: OSErr;
  144.                 ugNamePtr: StringPtr;
  145.                 ugVRefNum: INTEGER;
  146.                 ugRefNum: INTEGER;
  147.                 ugDirID: LONGINT;
  148.                 ugAccessID: LONGINT;
  149.                 ugUserID: LONGINT;
  150.                 ugGroupID: LONGINT;
  151.                 ugPosOffset: INTEGER;
  152.                 ugMisc: StringPtr;
  153.                 ugPrimaryFlag: Boolean;
  154.             end;
  155.  
  156.     { Use UGServerPB for UGGetULInfo and UGSetULInfo }
  157.         UGServerPB = record
  158.                 qLink: QElemPtr;
  159.                 qType: INTEGER;
  160.                 ugTrap: INTEGER;
  161.                 ugCmdAddr: Ptr;
  162.                 ugCompletion: ProcPtr;
  163.                 ugResult: OSErr;
  164.                 ugNamePtr: StringPtr;
  165.                 ugVRefNum: INTEGER;
  166.                 ugRefNum: INTEGER;
  167.                 ugDirID: LONGINT;
  168.                 ugAccessID: LONGINT;
  169.                 ugUserID: LONGINT;
  170.                 ugGroupID: LONGINT;
  171.                 ugAdminKey: StringPtr;
  172.                 ugSrvrVersion: INTEGER;
  173.                 ugChngFlags: INTEGER;
  174.                 ugSrvrFlags: array[0..1] of LONGINT;
  175.                 ugMinPwdLen: SignedByte;
  176.                 filler1: SignedByte;
  177.                 ugMaxBadLogins: INTEGER;
  178.                 ugPwdExpDate: LONGINT;
  179.             end;
  180.  
  181.         UserGroupPBPtr = ^UGParamBlockRec;
  182.         UGParamBlockRec = record
  183.                 case Integer of
  184.                     0: (
  185.                             ugFileParam: UGFilePB
  186.                     );
  187.                     1: (
  188.                             ugUserParam: UGUserPB
  189.                     );
  190.                     2: (
  191.                             ugGroupParam: UGGroupPB
  192.                     );
  193.                     3: (
  194.                             ugServerParam: UGServerPB
  195.                     );
  196.             end;
  197.  
  198.     { Declaration of functions }
  199.  
  200.     function UGOpenFile (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  201.     function UGCloseFile (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  202.     function UGCreateFile (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  203.  
  204.     function UGNewUser (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  205.     function UGDeleteUser (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  206.     function UGRenameUser (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  207.     function UGGetUserInfo (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  208.     function UGSetUserInfo (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  209.     function UGAuthenticateUser (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  210.  
  211.     function UGNewGroup (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  212.     function UGDeleteGroup (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  213.     function UGRenameGroup (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  214.     function UGGetGroupInfo (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  215.  
  216.     function UGAssignUserToGroup (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  217.     function UGDeleteUserFromGroup (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  218.  
  219.     function UGGetULInfo (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  220.     function UGSetULInfo (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
  221.  
  222. {$ALIGN RESET}
  223. {$POP}
  224.  
  225. end.